<template>
  <div class="navBar">
    <van-nav-bar
      :title="name"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
  </div>
</template>

<script>
import { useRouter } from "vue-router";
export default {
  name: "navBar",
  props: {
    name: {
      required: true,
      type: String,
      default() {
        return "";
      },
    },
  },
  setup() {
    const router = useRouter();
    function onClickLeft() {
      router.back();
    }
    return {
      onClickLeft,
    };
  },
};
</script>

<style lang="scss" scope>
.navBar {
  width: 100%;

  & .van-nav-bar__arrow {
    font-size: 20px;
  }
  & .van-nav-bar__title {
    font-size: 18px;
    font-weight: 540;
  }
  & .van-nav-bar__text {
    visibility: hidden;
  }
}
</style>
